package com.itfetter.api.client;


import com.itfetter.api.client.fallback.ItemClientFallback;
import com.itfetter.api.config.DefaultFeignConfig;
import com.itfetter.api.dto.ItemDTO;
import com.itfetter.api.dto.OrderDetailDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

@FeignClient( value = "item-service",configuration = DefaultFeignConfig.class,fallbackFactory = ItemClientFallback.class)
public interface ItemClient {
    @GetMapping("/items")
    List<ItemDTO> queryItemByIds(@RequestParam("ids")Collection<Long> ids );
    @PutMapping("/items/stock/deduct")
     void deductStock(@RequestBody List<OrderDetailDTO> items);
    @GetMapping("/items/{id}")
     ItemDTO queryItemById(@PathVariable("id") Long id);
}
